import { createRouter, createWebHistory } from 'vue-router'

// 主页面及子页面
const Home = () => import('../components/Home.vue')
const Login = () => import('../components/user/Login.vue')
const UserManager = () => import('../components/mulu/UserManager.vue')
const OrderManager = () => import('../components/mulu/OrderManager.vue')
const Mains = () => import('../components/comms/Mains.vue')
const YuanManager = () => import('../components/mulu/YuanManager.vue')
const HomeManager = () => import('../components/mulu/HomeManager.vue')
const Oldman = () => import('../components/mulu/Oldman.vue')
const HuanjingManager = () => import('../components/mulu/HuanjingManager.vue')
const RecyleManager = () => import('../components/mulu/RecyleManager.vue')
const LoadManager = () => import('../components/mulu/LoadManager.vue')
const ParkManager = () => import('../components/mulu/ParkManager.vue')
const JiankManager = () => import('../components/mulu/JiankManager.vue')
const TousuManager = () => import('../components/mulu/TousuManager.vue')
const WaterManager = () => import('../components/mulu/WaterManager.vue')
const XiaofangManager = () => import('../components/mulu/XiaofangManager.vue')
const GaokongManager = () => import('../components/mulu/GaokongManager.vue')
const forgetPass = () => import('../components/user/forgetPass.vue')
const ElevatorManager = () => import('../components/mulu/ElevatorManager.vue')
const ThouderManager = () => import('../components/mulu/ThouderManager.vue')
const DuiLaJi = () => import('../components/mulu/DuiLaJi.vue')
const MeiqijianceManager = () => import('../components/mulu/MeiqijianceManager.vue')
const JiangaiManager = () => import('../components/mulu/JinggaiManager.vue')
const KeyiManager = () => import('../components/mulu/KeyiManager.vue')
const light = () => import('../components/mulu/light.vue')
const Youxiang = () => import('../components/mulu/Youxiang.vue')
const map = () => import('../components/mulu/map.vue')
const chongwuManager = () => import('../components/mulu/chongwuManager.vue')
const toupiaoManager = () => import('../components/mulu/toupiaoManager.vue')
const jiesongManager = () => import('../components/mulu/jiesongManager.vue')
const yuyueManager = () => import('../components/mulu/yuyueManager.vue')
const paotuiManager = () => import('../components/mulu/paotuiManager.vue')
const chat = () => import('../components/mulu/Chat.vue')
const notice = () => import('../components/mulu/notice.vue')
const errpage = () => import('../components/mulu/404.vue')
const zufang = () => import('../components/mulu/zufang.vue')
const library = () => import('../components/mulu/libraryManager.vue')
const shiwu = () => import('../components/mulu/shiwuManager.vue')
const routes = [
  { path: '/', redirect: '/home' },
  {
    path: '/home',
    name: '首页',
    meta: { title: '首页' },
    component: Home,
    children: [
      { path: '/user', name: '用户', meta: { title: '用户' }, component: UserManager },
      { path: '/order', name: '车辆', meta: { title: '车辆' }, component: OrderManager },
      { path: '/map', name: '地图', meta: { title: '地图' }, component: map },
      { path: '/home', name: '', meta: { title: '' }, component: Mains },
      { path: '/yuan', name: '员工', meta: { title: '员工' }, component: YuanManager },
      { path: '/homes', name: '房屋', meta: { title: '房屋' }, component: HomeManager },
      { path: '/huanjing', name: '环境', meta: { title: '环境' }, component: HuanjingManager },
      { path: '/road', name: '道路', meta: { title: '道路' }, component: LoadManager },
      { path: '/recyle', name: '垃圾堆叠', meta: { title: '垃圾堆叠' }, component: RecyleManager },
      { path: '/parking', name: '停车', meta: { title: '停车' }, component: ParkManager },
      { path: '/youxiang', name: '邮箱', meta: { title: '邮箱' }, component: Youxiang },
      { path: '/report', name: '投诉', meta: { title: '投诉' }, component: TousuManager },
      { path: '/jiank', name: '监控', meta: { title: '监控' }, component: JiankManager },
      { path: '/water', name: '水管', meta: { title: '水电' }, component: WaterManager },
      { path: '/lighting', name: '电线', meta: { title: '水电' }, component: light },
      { path: '/fire', name: '消防栓', meta: { title: '消防栓' }, component: XiaofangManager },
      { path: '/pound', name: '井盖', meta: { title: '井盖' }, component: JiangaiManager },
      { path: '/parabola', name: '高空抛物', meta: { title: '高空抛物' }, component: GaokongManager },
      { path: '/caution', name: '可疑识别', meta: { title: '可疑识别' }, component: KeyiManager },
      { path: '/meiqijiance', name: '煤气监测', meta: { title: '煤气监测' }, component: MeiqijianceManager },
      { path: '/thunderstorm', name: '极端天气', meta: { title: '极端天气' }, component: ThouderManager },
      { path: '/elevator', name: '电梯', meta: { title: '电梯' }, component: ElevatorManager },
      { path: '/delete', name: '垃圾违规', meta: { title: '垃圾违规' }, component: DuiLaJi },
      { path: '/pet', name: '宠物', meta: { title: '宠物' }, component: chongwuManager },
      { path: '/vote', name: '投票', meta: { title: '投票' }, component: toupiaoManager },
      {path: '/delivery', name: '接送', meta: { title: '接送' }, component: jiesongManager },
      {path: '/appointment', name: '预约', meta: { title: '预约' }, component: yuyueManager },
      {path: '/errand', name: '跑腿', meta: { title: '跑腿' }, component: paotuiManager },
      {path: '/chat', name: '智能对话', meta: { title: '智能对话' }, component: chat },
      {path: '/notice', name: '通知公告', meta: { title: '通知公告' }, component: notice },
	  {path: '/Oldman', name: '独居老人', meta: { title: '独居老人' }, component: Oldman },
      {path: '/zufang', name: '租房', meta: { title: '租房' }, component: zufang },
      {path: '/:pathMatch(.*)*', name: '错误页面', meta: { title: '404' }, component: errpage },
      {path: '/library', name: '图书馆', meta: { title: '图书馆' }, component: library },
      {path: '/shiwu', name: '失物', meta: { title: '失物' }, component: shiwu },
    ]
  },
  { path: '/login', name: '登录', meta: { title: '登录' }, component: Login },
  { path: '/forget', name: '忘记密码', meta: { title: '找回密码' }, component: forgetPass },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
